package com.goods.business.converter;


import com.goods.common.model.business.ProductCategory;
import com.goods.common.vo.business.ProductCategoryTreeNodeVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;


import java.util.ArrayList;
import java.util.List;

@Component
public class ProductCategoryConverter {
    /**
     * 转voList
     * @param productCategoryList
     * @return
     */
    public List<ProductCategoryTreeNodeVO> converterToRoleVOList(List<ProductCategory> productCategoryList) {
        List<ProductCategoryTreeNodeVO> roleVOS=new ArrayList<>();
        if(!CollectionUtils.isEmpty(productCategoryList)){
            for (ProductCategory productCategory : productCategoryList) {
                ProductCategoryTreeNodeVO productCategoryTreeNodeVO = new ProductCategoryTreeNodeVO();
                BeanUtils.copyProperties(productCategory,productCategoryTreeNodeVO);
                roleVOS.add(productCategoryTreeNodeVO);
            }
        }
        return roleVOS;
    }


}
